from django.db import models


# 茶叶业绩
class Achievement(models.Model):
    # 茶叶产量
    tea_output = models.IntegerField()
    # 出口量
    tea_FigureRation = models.IntegerField()
    # 销量
    tea_SalesVolume = models.IntegerField()
    # 出口金额
    tea_ExportAmount = models.IntegerField()
    isDel = models.CharField(max_length=1, verbose_name="是否删除")

    class Meta:
        db_table = "tea_achievement"
        verbose_name = "省份"
        verbose_name_plural = verbose_name

    def __str__(self):
        return str(self.tea_output)


# 省份
class Province(models.Model):
    province_name = models.CharField(max_length=20, verbose_name="省份名字")
    agelimit_fk = models.ForeignKey("AgeLimit", on_delete=models.CASCADE)
    isDel = models.CharField(max_length=1, verbose_name="是否删除")

    class Meta:
        db_table = "tea_province"
        verbose_name = "省份"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.province_name


# 年限
class AgeLimit(models.Model):
    year = models.CharField(max_length=20, verbose_name="年从10开始")
    # 关联茶庆
    TeaCelebration_fk = models.ForeignKey("TeaCelebration", on_delete=models.CASCADE)
    # 关联茶叶业绩
    Achievement_fk = models.ForeignKey("Achievement", on_delete=models.CASCADE)
    isDel = models.CharField(max_length=1, verbose_name="是否删除")

    class Meta:
        db_table = "tea_agelimit"
        verbose_name = "年限"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.year


# 茶庆
class TeaCelebration(models.Model):
    name = models.CharField(max_length=20, verbose_name="省份")
    Festival_Name = models.CharField(max_length=255, verbose_name="节日名称")
    Festival_text = models.TextField(max_length=1000, verbose_name="节日名称")
    Activity_Name = models.CharField(max_length=255, verbose_name="活动名称")
    Activity_text = models.TextField(max_length=1000, verbose_name="活动概述")
    Activity_time = models.CharField(max_length=255, verbose_name="活动时间")
    isDel = models.CharField(max_length=1, verbose_name="是否删除")

    class Meta:
        db_table = "tea_celebration"
        verbose_name = "茶庆"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
